home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 502 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.0 KB

  1. Path: chronicle.mti.sgi.com!austern
  2. From: vavasis@CS.Cornell.EDU (Stephen Vavasis)
  3. Newsgroups: comp.std.c++
  4. Subject: standardizing routines without main()
  5. Date: 15 Feb 1996 09:20:36 PST
  6. Organization: Cornell Univ. CS Dept, Ithaca NY 14853
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4fvmd1$bh1@syn.cs.cornell.edu>
  9. NNTP-Posting-Host: isolde.mti.sgi.com
  10. X-Original-Date: 15 Feb 1996 11:18:41 -0500
  11. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  12.     iQBVAwUBMSNrcky4NqrwXLNJAQF7BwH8CwHHuGHYQhzMQPMpaMaPEAHKOh+qkgt6
  13.     PvH5n0e9Xj9lZiUcA4zp+VK+BUyJdaTiEbZT2miYEAPO0WZ9nkBxGQ==
  14.     =9o+A
  15. Originator: austern@isolde.mti.sgi.com
  16.  
  17. I would like to propose that the standard deal with the following
  18. issue.  I would like to write a subroutine in C++ that gets called by
  19. an existing program.  The subroutine might get loaded with a dynamic
  20. loader into an already compiled program to which I, the C++
  21. programmer, have no access.  I imagine other people have the same
  22. situation.
  23.  
  24. In this case, there is no C++ main().  Nonetheless, I would still like
  25. to use C++ features like global static data items whose constructors
  26. and destructors get called.
  27.  
  28. To handle this, I would like to be able to put an explicit call like
  29. "cpp_start()" at the entry point of the routine, and "cpp_finish()" at
  30. the end that would take care of all the initialization/cleanup C++
  31. normally does in main.  As programmer, I would take responsibility for
  32. making sure that nothing is done before cpp_start() or after
  33. cpp_finish().
  34.  
  35. In fact, some C++ implementations already offer such a call just for
  36. this purpose.  See, for example,
  37.      http://www.mathworks.com/1606.html
  38. which describes how to write dynamically-loadable C++ subroutines for
  39. matlab using the Watcom C++ compiler.
  40.  
  41. But as far as I know, the names of these start/finish calls are not
  42. standardized, so I can't count on portability.
  43.  
  44. Thanks,
  45. Steve Vavasis
  46. ---
  47. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  48.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  49.   in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  50.